package com.edu.neusoft.student.domain;

import javax.validation.constraints.*;
import java.math.BigDecimal;
import lombok.Data;

@Data
public class Car {

    @NotNull(message = "Car ID cannot be null")
    private Integer carid;

    @NotBlank(message = "Make cannot be blank")
    @Size(max = 50, message = "Make can be at most 50 characters long")
    private String make;

    @NotBlank(message = "Model cannot be blank")
    @Size(max = 50, message = "Model can be at most 50 characters long")
    private String model;

    @NotNull(message = "Year cannot be null")
    @Min(value = 1886, message = "Year must be greater than or equal to 1886") // Assuming the first car was made in 1886
    @Max(value = 2024, message = "Year must be less than or equal to the current year")
    private Integer year;

    @NotNull(message = "Price cannot be null")
    @DecimalMin(value = "0.0", inclusive = false, message = "Price must be greater than 0")
    private BigDecimal price;

    @NotNull(message = "Stock cannot be null")
    @Min(value = 0, message = "Stock cannot be less than 0")
    private Integer stock;

    @Size(max = 30, message = "Color can be at most 30 characters long")
    private String color;

    @Size(max = 50, message = "EngineType can be at most 50 characters long")
    private String enginetype;

    @NotNull(message = "Status cannot be null")
    @Pattern(regexp = "Available|Sold", message = "Status must be either 'Available' or 'Sold'")
    private String status;
}
